<template>
  <div class="app-container" :class="`${isShow ? '' : 'hide'}`" id="app">
    <router-view class="router-view"></router-view>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { getPlatForm } from '../../utils'

export default {
  data () {
    return {
      isShow: false
    }
  },
  computed: {
    ...mapGetters({
      user: 'getUser'
    })
  },
  watch: {
    isShow (val) {
      if (val) {
        setTimeout(() => {
          this.disableScreenshot()
        }, 1000)
      }
    }
  },
  mounted () {
    this.disableScreenshot()
  },
  methods: {
    /**
     * 监听截屏或录屏
     */
    disableScreenshot() {
      const _self = this
      const platform = getPlatForm()
      if (window.cordova && platform === 'android') {
        window.cordova.exec(function (success) {
          _self.isShow = true
        }, function (error) {
          console.log({ error })
        }, 'MideaCommon', 'watchScreenshot', [{
          'identifier': 'com.wordCard.demo', 'extra': {}, 'disableScreenshot': true
        }])
      }
    }
  }
}
</script>


<style lang="less">
@import "../../assets/css/index.less";
html, body {
  height: 100%;
}

.app-container {
  position: relative;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
</style>
